{include file="layout/header" /}

<div id="page-wrapper" style="min-height: 525px;">
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">产品列表</h1>
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    产品列表
                </div>
                <!-- /.panel-heading -->
                <div class="panel-body">
                    <div id="dataTables-example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
                        <div class="row">
                            <form action="{:url('goods/lst')}" method="post">
                                <div class="col-sm-3">
                                    <input type="text" class="form-control input-sm" placeholder="开始时间"
                                           aria-controls="dataTables-example" id="start" name="start" onClick="WdatePicker({lang:'zh-cn',dateFmt:'yyyy-MM-dd'})" readonly="readonly" value="{$start}">
                                </div>
                                <div class="col-sm-3">
                                    <input type="search" class="form-control input-sm" placeholder="结束时间"
                                           aria-controls="dataTables-example" id="end" name="end" onClick="WdatePicker({lang:'zh-cn',dateFmt:'yyyy-MM-dd'})" readonly="readonly"
                                    value="{$end}">
                                </div>

                                <div class="col-sm-3">
                                    <label>状态：</label>
                                    <select class="form-control" name="status" id="status">
                                        <option value='' {if condition="$status==''"}selected{/if}>请选择</option>
                                        <option value=0 {if condition="$status==='0'"}selected{/if}>有效</option>
                                        <option value=1 {if condition="$status==1"}selected{/if}>无效</option>
                                        <option value=2 {if condition="$status==2"}selected{/if}>编辑中</option>
                                    </select>
                                </div>
                                <div class="col-sm-3">
                                    <input type="search" class="form-control input-sm" placeholder="产品名称"
                                           aria-controls="dataTables-example" name="keyword" value="{$keyword}">
                                    <input type="submit" id="search" value="搜索">

                                </div>
                            </form>
                        </div>
                        <div class="row">
                            <div class="col-sm-12">
                                <table width="100%"
                                       class="table table-striped table-bordered table-hover dataTable no-footer dtr-inline"
                                       id="dataTables-example" role="grid" aria-describedby="dataTables-example_info"
                                       style="width: 100%;">
                                    <thead>
                                    <tr role="row">
                                        <th>产品名称</th>
                                        <th>评估名称</th>
                                        <th>产品类型</th>
                                        <th>价格</th>
                                        <th>服务年限</th>
                                        <th>状态</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>

                                    {volist name="goods" id="vo"}
                                    <tr class="gradeA odd" role="row">
                                        <td>{$vo.goods_name}</td>
                                        <td>{$vo.assessment_name}</td>
                                        <td>{$vo.goods_type_name}</td>
                                        <td>{$vo.price}</td>
                                        <td>{$vo.goods_life}年</td>
                                        <td>{if condition="$vo.status===0"}有效
                                            {elseif condition="$vo.status==1"/}无效
                                            {else/}编辑中
                                            {/if}</td>
                                        <td><a href="{:url('goods/edit',['id'=>$vo.id])}"><img src="__STATIC__/admin/img/icon_edit.gif" alt=""></a>  <a href="{:url('goods/view',['id'=>$vo.id])}"><img src="__STATIC__/admin/img/icon_view.gif" alt=""></a>  <a href="{:url('goods/delete',['id'=>$vo.id])}"><img src="__STATIC__/admin/img/icon_drop.gif" alt=""></a></td>
                                    </tr>
                                    {/volist}
                                    </tbody>
                                </table>
                                <div class="page" >{$goods->render()}</div>
                            </div>
                        </div>

                    </div>
                    <!-- /.table-responsive -->
                </div>
                <!-- /.panel-body -->
            </div>
            <!-- /.panel -->
        </div>
        <!-- /.col-lg-12 -->
    </div>
</div>
<script src="__STATIC__/admin/js/jquery-1.10.2/jquery.min.js"></script>
<script>
    $("#search").click(function(){
        var start = $('#start').val();
        var end = $('#end').val();
        if(start!='' && end!=''){
            start = new Date(Date.parse(start.replace(/-/g, "/")));
            start =  start.getTime();
            end = new Date(Date.parse(end.replace(/-/g, "/")));
            end =  end.getTime();
            if(end < start){
               alert('结束日期应该大于开始日期');
            }
        }


    });
</script>
{include file="layout/footer" /}